<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    
    <link href="${basePath}/static/css/Uploadify.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="${basePath}/static/js/ajaxfileupload.js"></script>
</head>
<body>

<div class="list_NR">
        <div class="loc">
            <h3 style="width:100%">第三方扫描文件上传</h3>
        </div>
        <div class="list_con_pdf clearfix">
        <form id="uploadForm" action="${basePath}/upload/localityUploadFile" method="post" enctype="multipart/form-data" onsubmit="return validatation()">
            <ul class="clearfix">
                <li class="left">
                    <div class="inputLable">
                        <div>
                            <label  id="uploadImg" for="files">选择文件夹</label>
                            <input type="file" id="files" name="files" webkitdirectory mozdirectory style="display:none" />
                        </div>
                    </div>

                </li>
                <li class="left">
                	<!-- <input type="submit" value="上传"/> -->
                  <a class="btn" id="ctlBtn" onclick="submitUpload()">上传</a>
                 <!--  <a class="btn" id="ajaxCtlBtn" onclick="ajaxSubmitUpload()">ajax上传</a> -->
                </li>
            </ul>
            </form>
            <div class="fileBox" id="fileList">
                <!--<div  class="uploader-list"></div>-->
            </div>
        </div>

    </div>


<!--文件上传-->
<script type="text/javascript">
	function validatation(){ 
		var file = document.getElementById('files'); 
  		if(file.value == ""){
  			alert("请选择要上传的文件夹！");
   			return false;
	   	}
	   	else{
	   		return true; 
	   	} 
	}
    $(function () {
        $("#files").on("change",function (e) {
            $("#fileList").html("");
            $.each(this.files,function (k,v) {
                //console.log(v.type+"="+v.webkitRelativePath);
                $("#fileList").append( '<div class="item">' +
                        '<span class="info">' + v.webkitRelativePath + '</span>' +
                        '</div>' );
            });
        });
    });
    
    
    //form提交
    function submitUpload(){
    	$("#uploadForm").submit();
    }
    
    function ajaxSubmitUpload(){
    	 $.ajaxFileUpload({
    	 	url: '${basePath}/upload/ajaxLocalityUploadFile', //服务器端请求地址  
	        secureuri: false, //是否需要安全协议，一般设置为false  
	       	fileElementId: 'files', //文件上传域的ID  
         	dataType: 'json', //返回值类型 一般设置为json  
	        enctype:'multipart/form-data',//注意一定要有该参数  
	       	success: function (data, status)  //服务器成功响应处理函数  
	        {  
	        	alert(data);       
	        },  
	        error: function (data, status, e)//服务器响应失败处理函数  
	        {  
	            alert(e);  
	        }  
	   });  
    	 
 
    }
    
</script>
</body>
</html>